package com.javasix;

public class RunTest implements Runnable {

    private  int count=1000;

    @Override
    public void run() {
        while (true){
            synchronized (this){
                if (count<100){
                    break;
                }
                System.out.println(Thread.currentThread().getName()+"拿到接力棒");
                for (int i = 10; i <=100 ; i+=10) {
                    try {
                        Thread.sleep(100);
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    System.out.println(Thread.currentThread().getName()+"跑了"+i+"米");
                }
                count-=100;
            }
        }

    }
}
